<template>
    <div>
        <div class="nav">
            <div class="return" v-on:click="back()">
                <span class="arrow"></span>
                <span class="back">返回</span>
            </div>
            <div class="nav_text">
                <p>退换货管理</p>
            </div>
        </div>
        <div class="body">
            <div v-show="show.pda_thqr">
                <button @click="ReturnMenu('RET_INV_SUBMITTED')"><span>销售退货单(待确认)</span> </button>
            </div>
            <div v-show="show.pda_thqh">
                <button @click="ReturnMenu('RET_INV_PENDING')"><span>销售退货单(待取回)</span></button>
            </div>
            <div v-show="show.pda_gysqh">
                <button @click="Supplier"><span>供应商取货</span></button>
            </div>
            <div v-show="show.pda_thdcx">
                <button @click="ReturnScan"><span>退货单查询</span></button>
            </div>
        </div>
    </div>
</template>
<script>
import smalloading from "./../../loading/smalloading";
export default {
  name: "returnGoods",
  data() {
    return {
      show: {
        pda_gysqh: false, //供应商取货
        pda_thdcx: false, //退货单查询
        pda_thqh: false, //销售退货单（待取回）
        pda_thqr: false //销售退货单（待确认）
      }
    };
  },
  methods: {
    back: function() {
      this.$router.push({ path: "/Nav" });
    },
    ReturnMenu: function(res) {
      //销售退货单(待确认)   销售退货单(待取回)
      sessionStorage.setItem("inventoryStatusId", res); //货物状态  待确认 RET_INV_SUBMITTED   待取回 RET_INV_PENDING
      sessionStorage.setItem("returnTypeId", "CUSTOMER_RETURN"); //CUSTOMER_RETURN：销售订单退货单
      sessionStorage.setItem("qrcode", ""); //returnId
      sessionStorage.setItem("target_", ""); //清空
      this.$router.push({ path: "/ReturnMenu" });
    },
    Supplier: function() {
      //供应商
      sessionStorage.setItem("target_", "supplier");
      this.$router.push({ path: "/" + "DeliveryScan" });
    },
    ReturnScan: function() {
      //退货单查询
      sessionStorage.setItem("target_", "returnScan");
      this.$router.push({ path: "/" + "DeliveryScan" });
    },
    showModule: function() {
      let session = sessionStorage.getItem("show_thh_module");
      if (session) {
        let show_thh_module = JSON.parse(session);
        for (let i = 0; i < show_thh_module.length; i++) {
          const element = show_thh_module[i];
          if (element == "pda_gysqh") {
            //供应商取货
            this.show.pda_gysqh = true;
          }
          if (element == "pda_thdcx") {
            //退货单查询
            this.show.pda_thdcx = true;
          }
          if (element == "pda_thqh") {
            //销售退货单（待取回）
            this.show.pda_thqh = true;
          }
          if (element == "pda_thqr") {
            //销售退货单（待确认）
            this.show.pda_thqr = true;
          }
        }
      }
    }
  },
  created: function() {
    // this.load_list();
    sessionStorage.removeItem("sign_img");
    this.showModule();
  }
};
</script>
<style lang="css" scoped>
button {
  width: 90%;
  height: 50px;
  box-shadow: 2px 2px 10px #a0b7c4;
  border-radius: 3px;
  margin-left: 5%;
  margin-top: 40px;
}
button span {
  font-size: 15px;
}
.body {
  margin: 1rem 0;
  background-color: #f8f8f8;
}
.arrow {
  border: 0.15rem solid #fff;
  border-width: 0.15rem 0 0 0.15rem;
  display: inline-block;
  height: 0.85rem;
  width: 0.85rem;
  -webkit-transform-origin: center center;
  -webkit-transform: rotate(135deg);
  -webkit-transition: all 0.5s ease-in 0.1s;
  transform-origin: center center;
  transform: rotate(-45deg);
  transition: all 0.5s ease-in 0.1s;
}

.return {
  width: 39%;
  padding-left: 1.5rem;
}

.back {
  font-size: 1.3rem;
  color: #fff;
}

.nav {
  line-height: 4.7rem;
  display: -webkit-box;
  background: #668292;
  height: 4.7rem;
}

.nav_text {
  font-size: 1.6rem;
  color: #fff;
}
</style>